ipc: ipc4: helper: drop redundant locking in ipc4_search_for_drv()#10861
ipc: ipc4: helper: drop redundant locking in ipc4_search_for_drv()#10861kv2019i wants to merge 1 commit into
Conversation
Drop the IRQ disable/enable in ipc4_search_for_drv(). The driver list is only modified at FW boot and when a new driver is registered at runtime via SOF_IPC4_GLB_LOAD_LIBRARY IPC. ipc4_search_for_drv() is only used when processing IPC messages. As IPC processing is serialized, it is not possible for the driver list to be modified concurrently with a call to ipc4_search_for_drv(). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
There was a problem hiding this comment.
Pull request overview
This PR removes the local IRQ disable/enable section from ipc4_search_for_drv() in the IPC4 helper, based on the assumption that IPC handling is serialized and cannot race with driver registration.
Changes:
- Removed
irq_local_disable()/irq_local_enable()and the associatedflagsvariable fromipc4_search_for_drv(). - Left UUID-based driver lookup otherwise unchanged.
| struct comp_driver_list *drivers = comp_drivers_get(); | ||
| struct list_item *clist; | ||
| const struct comp_driver *drv = NULL; | ||
| struct comp_driver_info *info; | ||
| uint32_t flags; | ||
|
|
There was a problem hiding this comment.
The old code did not protect against multicore case as it only disabled local interrupts. In any case, IPC processing is seriealized towards the host and even if IPC handling is on another core. So protection is simply not needed here access to drivers list is only triggered via IPC messages and IPC processing is serialized.
| irq_local_disable(flags); | ||
|
|
||
| /* search driver list with UUID */ | ||
| list_for_item(clist, &drivers->list) { |
There was a problem hiding this comment.
looking at other locations, where the driver list is manipulated, we find 3 cases in component.c in functions like comp_register(). And there the list is protected by a dedicated spin-lock (as is the right way to do that). But if we now decide that it needs no protection, maybe we can remove those too. Or maybe make ipc4_get_comp_drv() a syscall and have it take this lock too?
There was a problem hiding this comment.
Perhaps @lyakh but this PR is still valid, right?
Drop the IRQ disable/enable in ipc4_search_for_drv(). The driver list is only modified at FW boot and when a new driver is registered at runtime via SOF_IPC4_GLB_LOAD_LIBRARY IPC. ipc4_search_for_drv() is only used when processing IPC messages. As IPC processing is serialized, it is not possible for the driver list to be modified concurrently with a call to ipc4_search_for_drv().